﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Media.Imaging;

namespace Qplus.UI
{
    public partial class CreateChatroomControl : UserControl
    {
        public CreateChatroomControl()
        {
            InitializeComponent();
        }
        private void redBtnEx_Click(object sender, RoutedEventArgs e)
        {
            LayoutRoot.Background = redBtnEx.BorderBrush;
            //new SolidColorBrush(new Color() { A = 157, R = 242, G = 91, B = 132 });
            //{ A = byte.Parse(157.ToString()), R = byte.Parse(242.ToString()), G = byte.Parse(91.ToString()), B = byte.Parse(132.ToString()) })
        }

        private void yellowBtnEx_Click(object sender, RoutedEventArgs e)
        {
            LayoutRoot.Background = yellowBtnEx.BorderBrush;
            //new SolidColorBrush(new Color() { A = 110, R = 202, G = 194, B = 31 });
        }

        private void greenBtnEx_Click(object sender, RoutedEventArgs e)
        {
            LayoutRoot.Background = greenBtnEx.BorderBrush;
            //new SolidColorBrush(new Color() { A = 137, R = 246, G = 161, B = 45 });
        }

        private void blueBtnEx_Click(object sender, RoutedEventArgs e)
        {
            LayoutRoot.Background = blueBtnEx.BorderBrush;
            //new SolidColorBrush(new Color() { A = 156, R = 102, G = 197, B = 229 });
        }

        private void nameTxtBox_GotFocus(object sender, RoutedEventArgs e)
        {
            nameTxtBox.Text = "";
        }

        private void NOTUSE_checkBtnEx_Click(object sender, RoutedEventArgs e)
        {
            //ButtonEx[] btnArray = new ButtonEx[buttonNumber];
            //Border[] bdrArray = new Border[buttonNumber];
            /*
            Border bdrArray = new Border()
            {
                Margin = new Thickness(20),
                Background = LayoutRoot.Background//new SolidColorBrush(new Color() { A = byte.Parse((ra.Next(255)).ToString()), R = byte.Parse((ra.Next(255)).ToString()), G = byte.Parse((ra.Next(255)).ToString()), B = byte.Parse((ra.Next(255)).ToString()) })
            };
            ImageBrush imgBrh = new ImageBrush()
            {
                ImageSource = new BitmapImage(new Uri("/Qplus;component/Pic/icon_userhand_def.png", UriKind.RelativeOrAbsolute)),
                Stretch = Stretch.None
            };
            ButtonEx btnArray = new ButtonEx()
            {
                Content = nameTxtBox.Text,
                VerticalContentAlignment = System.Windows.VerticalAlignment.Bottom,

                PressedBorderBrush = new SolidColorBrush(new Color() { A = 0xff, R = 173, G = 216, B = 230 }),
                BorderBrush = new SolidColorBrush(Colors.Transparent),
                BorderThickness = new Thickness(8),
                //Style = (Style)App.Current.Resources["buttonExStyle"],
                Background = imgBrh,
                PressedBackground = imgBrh
            };

            Grid.SetColumn(bdrArray, 0);
            Grid.SetRow(bdrArray, i);
            Grid.SetColumn(btnArray, 0);
            Grid.SetRow(btnArray, i++);
            RowDefinition rowDef1 = new RowDefinition();
            //rowDef1.Height = new GridLength(200);
            LayoutRoot.RowDefinitions.Add(rowDef1);
            LayoutRoot.Children.Add(bdrArray);
            LayoutRoot.Children.Add(btnArray);
            EntryPage tmp = new EntryPage();
            //if (NavigationService.CanGoBack){NavigationService.GoBack();}
            //this.CloseMeAsPopup();
            this.Visibility = System.Windows.Visibility.Collapsed;*/
        }
    }
}
